package com.java1234.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.java1234.model.Manager;

import model.Admin;

public class ManagerDao {
	public ResultSet searchmanager(Connection c,String mname) throws SQLException
	{
		String sql="select * from manager where mname=?";
		PreparedStatement pstmt=c.prepareStatement(sql);
		pstmt.setString(1,mname);
		return pstmt.executeQuery();
	}
	public Admin login(Connection c,String id,String pwd) throws SQLException
	{
		Admin m=null;
		String sql="select * from manager where mno=? and mpassword=?";
		PreparedStatement pstmt=c.prepareStatement(sql);
		pstmt.setString(1,id);
		pstmt.setString(2,pwd);
		ResultSet rs=pstmt.executeQuery();
		while(rs.next())
		{
			m=new Admin();
			m.setAdmin_id(rs.getString("mno"));
			m.setAdmin_mail(rs.getString("memail"));
			m.setAdmin_name(rs.getString("mname"));
			m.setAdmin_password(rs.getString("mpassword"));
			m.setAdmin_sex(rs.getString("msex"));
			m.setAdmin_tel(rs.getString("mtel"));
		}
		return m;
		
	}
}
